class Cat:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def intro(self):
        print(f"我是一只沙雕猫咪，我叫{self.name}，今年{self.age}岁~")

    def say(self):
        print("mua~")


class Dog:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def intro(self):
        print(f"我是一只小狗，我叫{self.name}，今年{self.age}岁~")

    def say(self):
        print("哟吼~")


class Pig:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def intro(self):
        print(f"我是一只小猪，我叫{self.name}，今年{self.age}岁~")

    def say(self):
        print("oink~")


c = Cat("web", 4)
d = Dog("布布", 7)
p = Pig("大肠", 5)


# 多态
def animal(x):
    x.intro()
    x.say()


# 多态
animal(c)
animal(d)
animal(p)


class Bicycle:
    def intro(self):
        print("我曾经跨过山和大海～")

    def say(self):
        print("都有自行车了，要什么兰博基尼~")


print("=" * 100)

# 我们不要求她一定是动物，只要有 intro 跟 say 方法都可以调用
b = Bicycle()
animal(b)
